import axios from 'axios'
import qs from 'qs'

// export function login (form) {
//   return axios({
//     method: 'post',
//     url: 'http://172.16.81.238/LoginSuccess',
//     headers: {
//       'Content-Type': 'application/x-www-form-urlencoded'
//     },
//     data: qs.stringify(form)
//   })
// }

const baseUrl = 'http://101.35.134.51:8080/';

//待修改
export function getQuestions (page) {
  return axios({
    method: 'post',
    url: baseUrl + 'base-in-back-end/framework/question/page',
    headers: {
      'Content-Type': 'application/json'
    },
    data: {
      data: { isDel: false, isShow: true },
      limit: 10,
      seq: "string",
      start: page,
      token: "string"
    }
  })
}

export function addQuestion(form) {
  form.isShow = true;
  return axios({
    method: 'post',
    url: baseUrl + 'base-in-back-end/framework/question',
    headers: {
      'Content-Type': 'application/json'
    },
    data: {
      data: form,
      seq: "string",
      token: "string"
    }
  })
}

export function updateQuestion(id, obj) {
  return axios({
    method: 'put',
    url: baseUrl + 'base-in-back-end/framework/question/' + id,
    headers: {
      'Content-Type': 'application/json'
    },
    data: {
      data: obj,
      seq: "string",
      token: "string"
    }
  })
}

export function editQuestion(id, form) {
  return axios({
    method: 'put',
    url: baseUrl + 'base-in-back-end/framework/question/' + id,
    headers: {
      'Content-Type': 'application/json'
    },
    data: {
      data: form,
      seq: "string",
      token: "string"
    }
  })
}

export function deleteQuestion (id) {
  return axios({
    method: 'delete',
    url: baseUrl + 'base-in-back-end/framework/question/' + id,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}




